package com.captainbank.tcl.tclapplication.ui.activity.function;

import android.support.v7.widget.Toolbar;
import android.widget.SeekBar;
import android.widget.TextView;

import com.captainbank.tcl.tclapplication.R;
import com.captainbank.tcl.tclapplication.ui.activity.basic.BaseActivity;
import com.github.florent37.longshadow.LongShadow;

import butterknife.BindView;

/**
 * Created by TCL on 2019/6/5.
 * Describe:
 */
public class ShadowActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.seekbar)
    SeekBar seekbar;
    @BindView(R.id.tv_percent)
    TextView tvPercent;
    @BindView(R.id.shadow1)
    LongShadow shadow1;
    @BindView(R.id.shadow2)
    LongShadow shadow2;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_shadow;
    }

    @Override
    protected void initView() {
        toolbar.setTitle(getString(R.string.title_shadow));

    }

    @Override
    protected void setListener() {
        seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                Float flaotValue = (float)(3.6 * progress);
                tvPercent.setText(flaotValue + "°");
                shadow1.setShadowAngle(flaotValue);
                shadow2.setShadowAngle(flaotValue);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
        });
    }

}
